﻿--系统设置表
CREATE TABLE [dbo].[Devices]
(
	[Id] INT NOT NULL PRIMARY KEY , 
    [DeviceCode] NVARCHAR(50) NOT NULL, 
    [DeviceType] INT NOT NULL, 
	[DeviceDepID] int not null,
	[DeviceName] nvarchar(50) not null,
	[DeviceDes] nvarchar(250) not null,
	[DeviceInstall] nvarchar(250) not null,
    [DeviceMaxVoltage] FLOAT NULL, 
    [DeviceMinVoltage] FLOAT NULL, 
    [DeviceVoltage] FLOAT NULL, 
    [DeviceMaxElectricCurrent] FLOAT NULL, 
    [DeviceMinElectricCurrent] FLOAT NULL, 
    [DeviceElectricCurrent] FLOAT NULL, 
    [DeviceMaxTemperature] FLOAT NULL, 
    [DeviceMinTemperature] FLOAT NULL, 
    [DeviceTemperature] FLOAT NULL, 
    [DeviceMaxHumidity] FLOAT NULL, 
    [DeviceMinHumidity] FLOAT NULL, 
    [DeviceHumidity] FLOAT NULL, 
    [DeviceIsMaintain] INT NULL, 
    [DeviceLastUpDate] DATETIME NULL, 
    [DeviceUpDateTime] INT NULL, 
    [DeviceAddDateTime] DATETIME NULL 
)

GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备ID',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'Id'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备唯一编码',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceCode'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备类型',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceType'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备支持最高电压',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceMaxVoltage'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备支持最低电压',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceMinVoltage'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'当前电压',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceVoltage'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备支持最大电流',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceMaxElectricCurrent'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备支持最小电流',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceMinElectricCurrent'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备当前电流',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceElectricCurrent'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备工作最高温度',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceMaxTemperature'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备工作最低温度',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceMinTemperature'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备当前工作温度',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceTemperature'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备工作最大湿度',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceMaxHumidity'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备工作最小湿度',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceMinHumidity'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备当前工作湿度',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceHumidity'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备名称',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceName'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备描述',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceDes'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备安装位置',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceInstall'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备是否在维护中',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceIsMaintain'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'上一次更新数据时间',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceLastUpDate'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备更新数据时间（分钟）',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceUpDateTime'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备添加时间',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceAddDateTime'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设备所属组织机构ID',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'Devices',
    @level2type = N'COLUMN',
    @level2name = N'DeviceDepID'